package com.dba.example.gwt.client.places;

import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;
import com.google.gwt.place.shared.Prefix;

public class CompanyEditPlace extends Place {

	private Integer id;
	
	public CompanyEditPlace(String token) {
		if (token != null && !"".equals(token)) {
			id = new Integer(token);
		}
	}
	
	public CompanyEditPlace(Integer id) {
		this.id = id;
	}
	
	public Integer getId() {
		return id;
	}

	@Prefix("companyEdit")
	public static class Tokenizer implements PlaceTokenizer<CompanyEditPlace> {
		public String getToken(CompanyEditPlace place) {
			return place.getId() == null ? "" : place.getId().toString();
		}

		public CompanyEditPlace getPlace(String token) {
			return new CompanyEditPlace(token);
		}
	}
	
	public String toString() {
		return "companyEdit:" + (id == null ? "" : id.toString());
	}

}
